home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_seeker_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  2KB  |  64 lines

  1. #include "ewl_test.h"
  2.  
  3. static Ewl_Widget *seeker_button;
  4.  
  5. static void
  6. __destroy_seeker_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  7.                     void *user_data __UNUSED__)
  8. {
  9.     ewl_widget_destroy(w);
  10.     ewl_callback_append(seeker_button, EWL_CALLBACK_CLICKED,
  11.                 __create_seeker_test_window, NULL);
  12. }
  13.  
  14. static void
  15. __print_value(Ewl_Widget *w, void *ev_data __UNUSED__,
  16.                 void *user_data __UNUSED__)
  17. {
  18.     Ewl_Seeker *s;
  19.  
  20.     s = EWL_SEEKER(w);
  21.     printf("Seeker set to %g\n", ewl_seeker_value_get(s));
  22. }
  23.  
  24. void
  25. __create_seeker_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  26.                         void *user_data __UNUSED__)
  27. {
  28.     Ewl_Widget *seeker_win;
  29.     Ewl_Widget *hseeker, *vseeker;
  30.  
  31.     seeker_button = w;
  32.  
  33.     seeker_win = ewl_window_new();
  34.     ewl_window_title_set(EWL_WINDOW(seeker_win), "Seeker Test");
  35.     ewl_window_name_set(EWL_WINDOW(seeker_win), "EWL Test Application");
  36.     ewl_window_class_set(EWL_WINDOW(seeker_win), "EFL Test Application");
  37.     ewl_object_minimum_size_set(EWL_OBJECT(seeker_win), 300, 300);
  38.  
  39.     if (w) {
  40.         ewl_callback_del(w, EWL_CALLBACK_CLICKED,
  41.                  __create_seeker_test_window);
  42.         ewl_callback_append(seeker_win, EWL_CALLBACK_DELETE_WINDOW,
  43.                     __destroy_seeker_test_window, NULL);
  44.     } else
  45.         ewl_callback_append(seeker_win, EWL_CALLBACK_DELETE_WINDOW,
  46.                     __close_main_window, NULL);
  47.     ewl_widget_show(seeker_win);
  48.  
  49.     hseeker = ewl_hseeker_new();
  50.     ewl_object_position_request(EWL_OBJECT(hseeker), 30, 0);
  51.     ewl_callback_append(hseeker, EWL_CALLBACK_VALUE_CHANGED, __print_value,
  52.             NULL);
  53.     ewl_container_child_append(EWL_CONTAINER(seeker_win), hseeker);
  54.     ewl_widget_show(hseeker);
  55.  
  56.     vseeker = ewl_vseeker_new();
  57.     ewl_object_position_request(EWL_OBJECT(vseeker), 0, 30);
  58.     ewl_callback_append(vseeker, EWL_CALLBACK_VALUE_CHANGED, __print_value,
  59.             NULL);
  60.     ewl_container_child_append(EWL_CONTAINER(seeker_win), vseeker);
  61.     ewl_widget_show(vseeker);
  62. }
  63.  
  64.